package com.wpw.java7demo.callback;

public class CallbackTest {

	public static void main(String[] args) {
		Filter filter = new XXXFilter();
		FilterChain chain = new ApplicationFilterChain();
		filter.method(chain);
	}
}

interface FilterChain {
	
	public void doFilter();
}

class ApplicationFilterChain implements FilterChain {

	@Override
	public void doFilter() {
		System.out.println("这是回调方法，处理统一流程");
	}
	
	
}

interface Filter {
	public void method(FilterChain filterChanin);
}

class XXXFilter implements Filter {
	
	@Override
	public void method(FilterChain filterChanin) {
		System.out.println("前置处理");
		filterChanin.doFilter();
		System.out.println("后置处理");
	}
}